//
//  utils.hpp
//  yuzon
//
//  Created by Alvin on 2023/3/29.
//

#pragma once

#include <sys/time.h>
#include <opencv2/opencv.hpp>
#include "common.hpp"

inline int64_t GetCurrentTime() {
  struct timeval time;
  gettimeofday(&time, NULL);
  return time.tv_sec * 1000000 + time.tv_usec;
}

inline float GetElapsedTime(int64_t time) {
  return (GetCurrentTime() - time) / 1000.0f;
}

std::vector<std::string> LabelList(const std::string &label_path);

std::vector<std::vector<float>> AngleList(const std::string &angle_path);

std::vector<cv::Scalar> ColorMap(int64_t num, bool rgb = true);

void Permute(const cv::Mat &image, float *data);

int64_t ShapeProduct(const std::vector<int64_t> &shape);

bool CompareHumanResult(const HumanResult &a, const HumanResult &b);
